<?php

/**
 * XHTML_Title, xhtml_lib
 * 
 * This file contains the source code for the XHTML_Title class.
 * @author Fernando Jimenez Mocobono <fjmcool@gmail.com>
 * @version 0.1
 * @package xhtml_lib
 */

include_once "XHTML_I18n_Element.php";

/**
 * The XHTML_Title class is a handler for the title xhtml-strict tag as a part
 * of a xhtml-strict php-handler implementation.
 */
class XHTML_Meta extends XHTML_I18n_Element {
    
    // xhtml atributes
    
    /**
     * Unique identifier for the xhtml-meta-tag
     *
     * @var string
     */
    protected $id;
    
    /**
     * HTTP header connected to the content attribute.
     * Valid values: content-type, expires, refresh, set-cookie.
     *
     * @var string
     */
    protected $httpEquiv;
    
    /**
     * Name connected to the content attribute.
     * Valid values: author, description, keywords, generator, revised, others.
     *
     * @var string
     */
    protected $name;
    
    /**
     * Meta information to be associated with http-equiv or name.
     *
     * @var string
     */
    protected $content;
    
    /**
     * Format to be used to interpret the value of the content attribute.
     *
     * @var string
     */
    protected $scheme;
    
    
    //Methods
    
    /**
     * Constructs a XHTML_Meta object with its required content.
     * 
     * @param string $content.
     */
    function __construct($content)
    {
        $this->content = $content;
    }
    
    /**
     * Sets the unique identifier.
     *
     * @param string $id
     */
    function setId($id)
    {
        $this->id = $id;
    }
    
    /**
     * gets the unique identifier.
     *
     * @return string
     */
    function getId()
    {
        return $this->id;
    }
    
    /**
     * Sets the HTTP header connected to the content attribute.
     * Valid values: content-type, expires, refresh, set-cookie.
     *
     * @param string $httpEquiv
     */
    function setHttpEquiv($httpEquiv)
    {
        $this->httpEquiv = $httpEquiv;
    }
    
    /**
     * Gets the HTTP header connected to the content attribute.
     * Valid values: content-type, expires, refresh, set-cookie.
     * 
     * @return string
     */
    function getHttpEquiv()
    {
        $this->httpEquiv;
    }
    
    /**
     * Sets Name connected to the content attribute.
     * Valid values: author, description, keywords, generator, revised, others.
     *
     * @param string $name
     */
    function setName($name)
    {
        $this->name = $name;
    }
    
    /**
     * Gets Name connected to the content attribute.
     * Valid values: author, description, keywords, generator, revised, others.
     *
     * @return string
     */
    function getName()
    {
        return $this->name;
    }
    
    /**
     * Sets the meta information to be associated with http-equiv or name.
     *
     * @param string $content
     */
    function setContent($content)
    {
        $this->content = $content;
    }
    
    /**
     * Gets the meta information to be associated with http-equiv or name.
     *
     * @return string
     */
    function getContent()
    {
        return $this->content;
    }
    
    /**
     * Sets the format to be used to interpret the value of the content 
     * attribute.
     *
     * @param string $scheme
     */
    function setScheme($scheme)
    {
        $this->scheme = $scheme;
    }
    
    /**
     * Gets the Format to be used to interpret the value of the content 
     * attribute.
     * 
     * @return string
     */
    function getScheme()
    {
        return $this->scheme;
    }
    
    
    // Overriding the toString method for a proper implementation.
    
    /**
     * Returns the string representation for echoing the class atributes.
     *
     * @return string
     */
    function toString()
    {
        $auxString = "<meta".parent::toString();
        
        /*
         * Additions of the meta own attributes to the return string.
         */
        if (isset($this->id)) {
            $auxString = $auxString."id=\"".$this->id."\" ";
        }
        
        if (isset($this->httpEquiv)) {
            $auxString = $auxString."http-equiv=\"".$this->httpEquiv."\" ";
        }
        
        if (isset($this->name)) {
            $auxString = $auxString."name=\"".$this->name."\" ";
        }
        
        $auxString = $auxString."content=\"".$this->content."\" ";
        
        if (isset($this->schema)) {
            $auxString = $auxString."schema=\"".$this->schema."\" ";
        }
        
        $auxString = $auxString."/>\n";
        
        return $auxString;
    }
    
}

?>